<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>订单详情</title>
    <%@include file="../include/commonFile.jsp" %>
    <style type="text/css">
        body {
            min-width: auto !important;
            background-color: white !important;
        }

        .info-container {
            padding-top: 10px;
            margin: 0px auto;
        }


        .layui-input {
            border: 0px;
            display: inline-block!important;
            padding-left: 0px!important;
        }

        .layui-form-item {
            margin-bottom: 0px !important;
        }

        .layui-form-item .layui-inline {
            margin-bottom: 0px !important;
        }

        .layui-form-item .layui-input-inline {
            margin-bottom: 0px !important;
        }

        .user-infos {
            display: block;
            width: 100%;
        }


        .avater-big {
            width: 140px;
            height: 90px;
            display: inline-block;
            background-size: cover;
            background-repeat: no-repeat;
            background-position: center;
            position: relative;
            border: #fff 2px solid;
            border-radius: 4px;
        }


        .layui-form-item .layui-input-inline {
            width: 300px !important;
        }

        .footer-buttons {
            position: fixed;
            bottom: 0;
            right: 0;
            left: 0;
            background: #fff;
            padding: 10px;
            text-align: right
        }
        .footer-place{
            height: 58px;
        }

        .layui-table td, .layui-table th {
            padding: 5px 10px;
        }
    </style>
</head>
<body>
<div class="layui-form info-container">
    <table class="layui-table" lay-skin="nob">
        <colgroup>
            <col width="120">
            <col>
        </colgroup>
        <tbody>
        <c:if test="${not empty orderForm.picture}">
            <tr>
                <td class="tr"></td>
                <td class="tl">
                    <div class="member-logo">
                        <div class="user-infos">
                            <div class="avater-big" id="logo" style="background-image: <c:if test="${orderForm.picture != null}">url('${orderForm.picture}?imageMogr2/auto-orient/crop/126x126'),</c:if>url(../../image/avatar1.png);"></div>
                        </div>
                    </div>
                </td>
            </tr>
        </c:if>
            <tr>
                <td class="tr">支付金额</td>
                <td class="tl" style="word-break: break-all;">￥${orderForm.payment}</td>
            </tr>
            <tr>
                <td class="tr">订单名称</td>
                <td class="tl" style="word-break: break-all;">${orderForm.title}</td>
            </tr>
            <tr>
                <td class="tr">订单类型</td>
                <td class="tl">${orderForm.typeName}</td>
            </tr>
            <tr>
                <td class="tr">下单时间</td>
                <td class="tl">
                    <fmt:formatDate value="${orderForm.createDate}"  pattern="yyyy-MM-dd HH:mm:ss"/>
                </td>
            </tr>
            <tr>
                <td class="tr">更新时间</td>
                <td class="tl">
                    <fmt:formatDate value="${orderForm.updateDate}"  pattern="yyyy-MM-dd HH:mm:ss"/>
                </td>
            </tr>
            <c:if test="${orderForm.payment != 0.0 && (orderForm.status == 2 || orderForm.status == 4) && orderForm.paymentWay != 2}">
                <tr>
                    <td class="tr">支付类型</td>
                    <td class="tl" style="word-break: break-all;">
                        <c:if test="${orderForm.paymentWay == 0}">支付宝</c:if>
                        <c:if test="${orderForm.paymentWay == 1}">微信</c:if>
                    </td>
                </tr>
            </c:if>
            <tr>
                <td class="tr">交易状态</td>
                <td class="tl">${orderForm.tradeState}</td>
            </tr>
            <tr>
                <td class="tr">订单状态</td>
                <td class="tl">
                    <c:choose>
                        <c:when test="${orderForm.status == 0}">
                            <span>审核中</span>
                        </c:when>
                        <c:when test="${orderForm.status == 1}">
                            <span>待支付</span>
                        </c:when>
                        <c:when test="${orderForm.status == 2}">
                            <span style="color: red;">已支付</span>
                        </c:when>
                        <c:when test="${orderForm.status == 3}">
                            <span>其它</span>
                        </c:when>
                        <c:when test="${orderForm.status == 4}">
                            <span>已退款</span>
                        </c:when>
                    </c:choose>
                </td>
            </tr>
            <c:if test="${not empty orderForm.transactionId}">
                <tr>
                    <td class="tr">交易单号</td>
                    <td class="tl">${orderForm.transactionId}</td>
                </tr>
            </c:if>
            <tr>
                <td class="tr">订单编号</td>
                <td class="tl">${orderForm.id}</td>
            </tr>
            <c:if test="${orderForm.paymentWay == 1}">
                <tr>
                    <td class="tr">商户号</td>
                    <td class="tl">${orderForm.merchantId}</td>
                </tr>
                <tr>
                    <td class="tr">商户名称</td>
                    <td class="tl">${orderForm.merchantName}</td>
                </tr>
            </c:if>
            <c:if test="${not empty orderForm.linkman}">
                <tr>
                    <td class="tr">联系人</td>
                    <td class="tl">${orderForm.linkman}</td>
                </tr>
            </c:if>
            <c:if test="${not empty orderForm.phone}">
                <tr>
                    <td class="tr">联系电话</td>
                    <td class="tl">${orderForm.phone}</td>
                </tr>
            </c:if>
            <tr>
                <td class="tr">购买份数</td>
                <td class="tl" style="word-break: break-all;">${orderForm.unit}份</td>
            </tr>
            <c:if test="${fn:length(orderForm.goodsCoupons) > 0}">
                <tr>
                    <td class="tr">核销码</td>
                    <td class="tl">
                        <c:forEach var="t" items="${orderForm.goodsCoupons}">
                            ${t.verifyCode} &nbsp;&nbsp;
                        </c:forEach>
                    </td>
                </tr>
            </c:if>
            <c:if test="${not empty response.errCode}">
                <tr>
                    <td class="tr">错误代码</td>
                    <td class="tl">${response.errCode}</td>
                </tr>
            </c:if>
            <c:if test="${not empty response.errCodeDes}">
                <tr>
                    <td class="tr">错误描述</td>
                    <td class="tl"><div style="width: 300px">${response.errCodeDes}</div></td>
                </tr>
            </c:if>
            <c:if test="${response.returnCode == 'FAIL'}">
                <tr>
                    <td class="tr">错误代码</td>
                    <td class="tl">${response.returnCode}</td>
                </tr>
                <c:if test="${not empty response.returnMsg}">
                    <tr>
                        <td class="tr">错误描述</td>
                        <td class="tl"><div style="width: 300px">${response.returnMsg}</div></td>
                    </tr>
                </c:if>
            </c:if>
        </tbody>
    </table>
    <div class="footer-buttons">
        <a class="layui-btn layui-btn-danger"  href="javascript:check('${orderForm.id}')">对账</a>
        <a class="layui-btn layui-btn-normal" href="javascript:closeSelf()" >关闭</a>
    </div>
    <div class="footer-place"></div>
</div>
</body>
<script type="text/javascript">
    function check(orderId) {
        $.post("${ctx}/payquery/orderQuery.do", {
            "orderId": orderId
        }, function (data) {
            if (data.success == true) {
                util.layerAlertSuccess("对账成功!", function () {
                    window.location.reload();
                })
            } else {
                util.layerMsgError(data.description)
            }
        });
    }
    function closeSelf() {
        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        top.layer.close(index);
    }
</script>
</html>